﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Framework
{

    /// <summary>
    /// 动画好像没什么要改的，写到我手软，就不继续了
    /// </summary>

    public abstract class Timeline : Base
    {
        static Timeline()
        {
            RegisterType(typeof(Timeline));

            RegisterProp(typeof(Timeline), "AutoReverse", typeof(bool), null);
            RegisterProp(typeof(Timeline), "BeginTime", typeof(Nullable<TimeSpan>), null);
            RegisterProp(typeof(Timeline), "Duration", typeof(Duration), null);
            RegisterProp(typeof(Timeline), "FillBehavior", typeof(FillBehavior), null);
            RegisterProp(typeof(Timeline), "RepeatBehavior", typeof(RepeatBehavior), null);
            RegisterProp(typeof(Timeline), "SpeedRatio", typeof(double), null);
        }

        public event EventHandler Completed;
    }

    public enum FillBehavior
    {
        HoldEnd,Stop
    } 

    public struct RepeatBehavior
    {
        public double Count;
        public TimeSpan Duration;
        public static RepeatBehavior Forever;
        public bool HasCount;
        public bool HasDuration;
    }

    public sealed class Storyboard : Timeline
    {
        static Storyboard()
        {
            RegisterType(typeof(Storyboard), typeof(Timeline));
            RegisterProp(typeof(Storyboard), "Children", typeof(Collection<Timeline>), null);
        }

        public void Begin()
        {

        }
         
        public ClockState GetCurrentState()
        {
            throw new NotImplementedException();
        }

        public TimeSpan GetCurrentTime()
        {
            throw new NotImplementedException();
            
        }

        public static string GetTargetName(Timeline element)
        {
            throw new NotImplementedException();
        }

        public static string GetTargetProperty(Timeline element)
        {
            throw new NotImplementedException();            
        }

        public void Pause()
        {
            
        }

        public void Resume()
        {
            
        }

        public void Seek(TimeSpan offset)
        {
            throw new NotImplementedException();
            
        }

        public void SeekAlignedToLastTick(TimeSpan offset)
        {
            
        }

        public static void SetTarget(Timeline timeline,Base target)
        {
            
        }

        public static void SetTargetName(Timeline element,string name)
        {
            
        }

        public static void SetTargetProperty(Timeline element,string path)
        {
            
        }

        public void SkipToFill()
        {
            
        }

        public void Stop()
        {
            
        }
    }

    public enum ClockState
    {
        Active,Filling,Stopped
    }

    public abstract class PointKeyFrame
    {
        [Map("KeyTime")] 
        public TimeSpan KeyTime;
        public Point Value;

    }

    public abstract class EasingFunctionBase : Base
    {
        public abstract double EaseInCore(double time);

    }

    public class BackEase : EasingFunctionBase
    {
        public override double EaseInCore(double time)
        {
            return 0.0;
        }
    }

    public class BounceEase : EasingFunctionBase
    {
        public override double EaseInCore(double time)
        {
            return 0.0;
        }
    }

    public class CircleEase : EasingFunctionBase
    {
        public override double EaseInCore(double time)
        {
            return 0.0;
        }
    }

    public class CubicEase : EasingFunctionBase
    {
        public override double EaseInCore(double time)
        {
            return 0.0;
        }
    }

    public class ElasticEase : EasingFunctionBase
    {
        public override double EaseInCore(double time)
        {
            return 0.0;
        }
    }

    public class ExponentialEase : EasingFunctionBase
    {
        public override double EaseInCore(double time)
        {
            return 0.0;
        }
    }

    public class PowerEase : EasingFunctionBase
    {
        public override double EaseInCore(double time)
        {
            return 0.0;
        }
    }

    public class QuadraticEase : EasingFunctionBase
    {
        public override double EaseInCore(double time)
        {
            return 0.0;
        }
    }

    public class QuarticEase : EasingFunctionBase
    {
        public override double EaseInCore(double time)
        {
            return 0.0;
        }
        
    }

    public class QuinticEase : EasingFunctionBase
    {
        public override double EaseInCore(double time)
        {
            return 0.0;
        }
    }

    public class SineEase : EasingFunctionBase
    {
        public override double EaseInCore(double time)
        {
            return 0.0;
        }
    }
}
